package com.snoob.springboot.enterprise.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.snoob.springboot.enterprise.entity.EnterpriseUserEntity;
import com.snoob.springboot.enterprise.service.EnterpriseUserService;
import com.snoob.springboot.pipleline.qo.SelectEnterpriseUserQo;
import com.snoob.springboot.pipleline.vo.InsertEnterpriseUserVoReq;
import com.snoob.springboot.pipleline.vo.SelectEnterpriseUserByPageVoRes;
import com.snoob.springboot.util.ConvertUtils;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @描述：企业用户
 * @作者：lixing_java@163.com
 * @时间：2022/5/14 16:16
 */
//@RestController
//@RequestMapping("/enterpriseUser")
@Component
public class EnterpriseUserController {
    @Resource
    private EnterpriseUserService enterpriseUserService;

    /**
     * @描述 分页查询企业用户信息
     */
    public Page<SelectEnterpriseUserByPageVoRes> selectEnterpriseUserByPage(SelectEnterpriseUserQo qo) {
        return enterpriseUserService.selectEnterpriseUserByPage(qo);
    }

    /**
     * @描述 添加企业用户信息
     */
    public String insertEnterpriseUser(InsertEnterpriseUserVoReq vo) {
        EnterpriseUserEntity enterpriseUserEntity = ConvertUtils.convert(vo, EnterpriseUserEntity.class);
        String userAccount = enterpriseUserService.insertEnterpriseUser(enterpriseUserEntity);
        return userAccount;
    }

    /**
     * @描述 查询企业用户信息
     */
    public EnterpriseUserEntity selectEnterpriseUser(SelectEnterpriseUserQo qo) {
        return enterpriseUserService.selectEnterpriseUser(qo);
    }
}

